Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Htop sorting CPU% column incorrectly #810

Open
jhyland87 opened this issue Jul 6, 2018 · 4 comments
Open

Htop sorting CPU% column incorrectly #810

jhyland87 opened this issue Jul 6, 2018 · 4 comments

Comments

@jhyland87
Copy link

Sometimes when I'm trying to diagnose what process is hogging all of my laptops resources, I notice that htop will sort the CPU% column incorrectly. Example below:
screen shot 2018-07-06 at 10 47 23 am

The CPU% column is highlighted in the header row, so that means its sorting by that column (right?), yet its all out of order. Its clearly not sorting it numerically, and neither is it sorting it lexicographically. I'm not sure how else it could be trying to sort it.

Some Details:

  • Laptop: MacBook Pro (17-inch, Late 2011)
  • OS: El Capitan v10.11.6 (15G31)
  • Htop Version: htop 2.1.0

Here's the content of my ~/.config/htop/htoprc file.

# Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly.
fields=0 48 17 18 38 39 2 46 47 49 1
sort_key=46
sort_direction=1
hide_threads=0
hide_kernel_threads=1
hide_userland_threads=0
shadow_other_users=0
show_thread_names=0
show_program_path=1
highlight_base_name=0
highlight_megabytes=1
highlight_threads=0
tree_view=0
header_margin=1
detailed_cpu_time=0
cpu_count_from_zero=0
update_process_names=0
account_guest_in_cpu_meter=0
color_scheme=6
delay=15
left_meters=AllCPUs Memory Swap
left_meter_modes=1 1 1
right_meters=Tasks LoadAverage Uptime
right_meter_modes=2 2 2

I wasn't able to find much on it after consulting with the Google Gods. Is this a known bug? Or is it perhaps a PEBKAC error? (i hope not, that would be embarrassing)

Any input is appreciated.
Thanks!
-J

@swarmer
Copy link

swarmer commented Nov 5, 2018

I remember seeing this for like the past year or more. Reproducing on ubuntu right now. If you, say, sort by memory, then sort by cpu and then do nothing, I think the sorting is correct. As soon as I move the highlighted line up or down, sorting breaks.

@theferrit32
Copy link

theferrit32 commented May 17, 2019

I am also seeing this, for some time (over a year). After interacting with the list like moving the highlighted row, it goes out of order. The ordering is trending in the right order (it isn't a random ordering) but many entries are not in the correct sorted position. Re-triggering the sort by CPU fixes the ordering.

Looking at it again now, it seems that over time after sufficiently many updates and re-writes of the terminal during which time there were no input/interactions with it, the ordering stabilizes back in sorted order.

My version is htop 2.2.0 on Arch Linux, but I have also observed it on Centos 7 and Ubuntu 18.04.

@nyanpasu64
Copy link

Same issue with htop 2.2.0 running on Termux (Android app supplying a real Linux userspace) using tsu (su to root, while keeping Termux userspace). Deleting ~/.config/htop/htoprc did not help. The issue appears as soon as I move the focused row away from the top task.

@mauricev
Copy link

I see this on my Mac, 10.14.6. Keep it running long enough, particularly under high CPU load and htop forgets this default order. Quit and restart it, and it's working again.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants